clear all
set more off
cd "/homes/nber/yasenov"

use "~/matched_30_40_ready.dta"

label var dmex " $MexPopDrop\_c$ "

********************
*** REGRESSIONS ****
********************
global ind_controls age_A married_A black literate_A c.age_A#c.age_A c.age_A#i.black c.age_A#i.married_A i.black#i.married_A c.age_A#i.literate_A i.literate_A#i.black i.literate_A#i.married
global cnty_controls lnpop30 s_young s_agric s_mf s_urban s_illiterate dustbowl extreme_phdi pop_dens
global more_controls $cnty_controls rldf3329 c.rldf3329#c.rldf3329 miles_to_mex c.miles_to_mex#c.miles_to_mex c.miles_to_mex#c.rldf3329 aa relief loan death_rate rldf3933 c.rldf3933#c.rldf3933

global options cluster(county) absorb(statefip_A)

***************
***************
***************


******************** TABLE 1: EMPLOYMENT *******************
eststo clear
eststo: reghdfe dempl dmex $ind_controls $cnty_controls, $options
qui estadd ysumm
eststo: reghdfe dempl dmex $ind_controls $more_controls, $options
qui estadd ysumm

eststo: ivreghdfe dempl $ind_controls $cnty_controls (dmex = mex_share10), $options
qui estadd ysumm
eststo: ivreghdfe dempl $ind_controls $more_controls (dmex = mex_share10), $options
qui estadd ysumm

eststo: ivreghdfe dempl $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm
eststo: ivreghdfe dempl $ind_controls $more_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm

eststo: ivreghdfe dempl $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm
eststo: ivreghdfe dempl $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm

esttab using "~/empl.tex", ///
	keep(dmex) ///
	replace se(3) b(3) stats(N ymean, labels("N" "$\bar{Y}$") fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("{\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}\begin{tabular}{l*{8}{c}}\hline\hline \\ & \multicolumn{8}{c}{\textbf{Panel A: $\Delta$ Employment 1930-1940}} \\\cmidrule(lr){2-9} %") ///
	postfoot("")

eststo clear	
eststo: reghdfe dempl_1 dmex $ind_controls $cnty_controls, $options
qui estadd ysumm
eststo: reghdfe dempl_1 dmex $ind_controls $more_controls, $options
qui estadd ysumm

eststo: ivreghdfe dempl_1 $ind_controls $cnty_controls (dmex = mex_share10), $options
qui estadd ysumm
eststo: ivreghdfe dempl_1 $ind_controls $more_controls (dmex = mex_share10), $options
qui estadd ysumm

eststo: ivreghdfe dempl_1 $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm
eststo: ivreghdfe dempl_1 $ind_controls $more_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm

eststo: ivreghdfe dempl_1 $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm
eststo: ivreghdfe dempl_1 $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm

esttab using "~/empl.tex", ///
	keep(dmex) ///
	append se(3) b(3) stats(N ymean, labels("N" "$\bar{Y}$") fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("\\ & \multicolumn{8}{c}{\textbf{Panel B: Non-Employed 1930 $\rightarrow$ Employed 1940}} \\\cmidrule(lr){2-9} %") ///
	postfoot("")

eststo clear	
eststo: reghdfe dempl_2 dmex $ind_controls $cnty_controls, $options
qui estadd ysumm
eststo: reghdfe dempl_2 dmex $ind_controls $more_controls, $options
qui estadd ysumm

eststo: ivreghdfe dempl_2 $ind_controls $cnty_controls (dmex = mex_share10), $options
qui estadd ysumm
eststo: ivreghdfe dempl_2 $ind_controls $more_controls (dmex = mex_share10), $options
qui estadd ysumm

eststo: ivreghdfe dempl_2 $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm
eststo: ivreghdfe dempl_2 $ind_controls $more_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm

eststo: ivreghdfe dempl_2 $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm
eststo: ivreghdfe dempl_2 $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm

esttab using "~/empl.tex", ///
	keep(dmex) ///
	append se(3) b(3) stats(N ymean, labels("N" "$\bar{Y}$") fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("\\ & \multicolumn{8}{c}{\textbf{Panel C: Employed 1930 $\rightarrow$ Non-Employed 1940}} \\\cmidrule(lr){2-9} %") ///
	postfoot("")

eststo clear	
eststo: reghdfe dself dmex $ind_controls $cnty_controls, $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols "X"
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: reghdfe dself dmex $ind_controls $more_controls, $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols "X"
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe dself $ind_controls $cnty_controls (dmex = mex_share10), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 "X"
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe dself $ind_controls $more_controls (dmex = mex_share10), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 "X"
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe dself $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 "X"
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe dself $ind_controls $more_controls rail2 (dmex = rail_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 "X"
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe dself $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 "X"
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe dself $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 "X"
estadd local iv5 ""
qui estadd ysumm

esttab using "~/empl.tex", ///
	keep(dmex) ///
	append se(3) b(3) stats(N ymean bslncntrl morecntrls ols iv1 iv3 iv4, labels("N" "$\bar{Y}$" "Baseline Controls" "Full Controls" "OLS" "Enclave IV" "Railroad IV" "Close to RR IV" ) fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("\\ & \multicolumn{8}{c}{\textbf{Panel D: $\Delta$ Self-Employment 1930-1940}} \\\cmidrule(lr){2-9} %")
 
   
******************** TABLE 2: WAGE *******************
eststo clear
eststo: reghdfe dwage dmex $ind_controls $cnty_controls, $options
qui estadd ysumm
eststo: reghdfe dwage dmex $ind_controls $more_controls, $options
qui estadd ysumm

eststo: ivreghdfe dwage $ind_controls $cnty_controls (dmex = mex_share10), $options
qui estadd ysumm
eststo: ivreghdfe dwage $ind_controls $more_controls (dmex = mex_share10), $options
qui estadd ysumm

eststo: ivreghdfe dwage $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm
eststo: ivreghdfe dwage $ind_controls $more_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm

eststo: ivreghdfe dwage $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm
eststo: ivreghdfe dwage $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm

esttab using "~/wage.tex", ///
	keep(dmex) ///
	replace se(3) b(3) stats(N ymean, labels("N" "$\bar{Y}$") fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("{\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}\begin{tabular}{l*{10}{c}}\hline\hline \\ & \multicolumn{8}{c}{\textbf{Panel A: $\Delta$ Occupational Wage 1930-1940}} \\\cmidrule(lr){2-9} %") ///
	postfoot("")



eststo clear	
eststo: reghdfe doccscore dmex $ind_controls $cnty_controls, $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols "X"
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: reghdfe doccscore dmex $ind_controls $more_controls, $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols "X"
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe doccscore $ind_controls $cnty_controls (dmex = mex_share10), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 "X"
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe doccscore $ind_controls $more_controls (dmex = mex_share10), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 "X"
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe doccscore $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 "X"
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe doccscore $ind_controls $more_controls rail2 (dmex = rail_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 "X"
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe doccscore $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 "X"
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe doccscore $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 "X"
estadd local iv5 ""
qui estadd ysumm

esttab using "~/wage.tex", ///
	keep(dmex) ///
	append se(3) b(3) stats(N ymean bslncntrl morecntrls ols iv1 iv3 iv4, labels("N" "$\bar{Y}$" "Baseline Controls" "Full Controls" "OLS" "Enclave IV" "Railroad IV" "Close to RR IV" ) fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("\\ & \multicolumn{8}{c}{\textbf{Panel B: $\Delta$ Occupational Score 1930-1940}} \\\cmidrule(lr){2-9} %")
 



******************** TABLE 3: MIGRATION *******************

eststo clear
eststo: reghdfe stayer dmex $ind_controls $cnty_controls, $options
qui estadd ysumm
eststo: reghdfe stayer dmex $ind_controls $more_controls, $options
qui estadd ysumm

eststo: ivreghdfe stayer $ind_controls $cnty_controls (dmex = mex_share10), $options
qui estadd ysumm
eststo: ivreghdfe stayer $ind_controls $more_controls (dmex = mex_share10), $options
qui estadd ysumm

eststo: ivreghdfe stayer $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm
eststo: ivreghdfe stayer $ind_controls $more_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm

eststo: ivreghdfe stayer $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm
eststo: ivreghdfe stayer $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm

esttab using "~/migr.tex", ///
	keep(dmex) ///
	replace se(3) b(3) stats(N ymean, labels("N" "$\bar{Y}$") fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("{\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}\begin{tabular}{l*{10}{c}}\hline\hline \\ & \multicolumn{8}{c}{\textbf{Panel A: Same State 1930-1935}} \\\cmidrule(lr){2-9} %") ///
	postfoot("")

eststo clear	
eststo: reghdfe stayer2 dmex $ind_controls $cnty_controls, $options
qui estadd ysumm
eststo: reghdfe stayer2 dmex $ind_controls $more_controls, $options
qui estadd ysumm

eststo: ivreghdfe stayer2 $ind_controls $cnty_controls (dmex = mex_share10), $options
qui estadd ysumm
eststo: ivreghdfe stayer2 $ind_controls $more_controls (dmex = mex_share10), $options
qui estadd ysumm

eststo: ivreghdfe stayer2 $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm
eststo: ivreghdfe stayer2 $ind_controls $more_controls rail2 (dmex = rail_interact), $options
qui estadd ysumm

eststo: ivreghdfe stayer2 $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm
eststo: ivreghdfe stayer2 $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
qui estadd ysumm

esttab using "~/migr.tex", ///
	keep(dmex) ///
	append se(3) b(3) stats(N ymean, labels("N" "$\bar{Y}$") fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("\\ & \multicolumn{8}{c}{\textbf{Panel B: Same State 1930-1940}} \\\cmidrule(lr){2-9} %") ///
	postfoot("")
	
eststo clear	
eststo: reghdfe drural_2 dmex $ind_controls $cnty_controls, $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols "X"
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: reghdfe drural_2 dmex $ind_controls $more_controls, $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols "X"
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe drural_2 $ind_controls $cnty_controls (dmex = mex_share10), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 "X"
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe drural_2 $ind_controls $more_controls (dmex = mex_share10), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 "X"
estadd local iv3 ""
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe drural_2 $ind_controls $cnty_controls rail2 (dmex = rail_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 "X"
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe drural_2 $ind_controls $more_controls rail2 (dmex = rail_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 "X"
estadd local iv4 ""
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe drural_2 $ind_controls $cnty_controls close_to_rr (dmex = close_to_rr_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 "X"
estadd local iv5 ""
qui estadd ysumm
eststo: ivreghdfe drural_2 $ind_controls $more_controls close_to_rr (dmex = close_to_rr_interact), $options
estadd local bslncntrl "X"
estadd local morecntrls "X" 
estadd local ols ""
estadd local iv1 ""
estadd local iv3 ""
estadd local iv4 "X"
estadd local iv5 ""

esttab using "~/migr.tex", ///
	keep(dmex) ///
	append se(3) b(3) stats(N ymean bslncntrl morecntrls ols iv1 iv3 iv4, labels("N" "$\bar{Y}$" "Baseline Controls" "Full Controls" "OLS" "Enclave IV" "Railroad IV" "Close to RR IV" ) fmt(0 3)) star(* 0.10 ** 0.05 *** 0.01) nonum nonotes noconstant nogaps label ///
	mtitles("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)") /// 
	prehead("\\ & \multicolumn{8}{c}{\textbf{Panel C: Rural 1930 $\rightarrow$ Urban 1940}} \\\cmidrule(lr){2-9} %")
